Skip to main content

Result

The Result class encapsulates the response from an API call.

Class description

This class stores the response body, status code, and headers. It is used to wrap network response information in a structured format.

Class definition
export default class Result {
status;
headers;
body;

constructor(body: any, response: Response)
}

Constructor parameters

  • body: any – The parsed response body, typically JSON or text returned from the request.
  • response: Response – The native Response object from the Fetch API containing metadata such as status and headers.

Properties

  • status: number – The HTTP status code of the response (e.g., 200, 404).
  • headers: Headers – The headers returned with the response.
  • body: any – The parsed body content of the response.